<?php
require('connect.sql.php');
require('sql.function.php');
require('admin.function.php');


session_start();
if(isset($_SESSION['userid']))
{
	$power=getdataf('duty',"usertable","userid",$_SESSION['userid']);
	//如果是普通用户
	if($power){
		include("user.function.php");
		include("../views/user.head.php");
		include("../views/user.index.php");
		user_index(1);
		include("../views/user.bottom.php");

	}
	else{
		if(isset($_POST['getp'])){
		if($_POST['getp'])
		{
			include('../views/admin.project.update.php');
			$thissort=get_thissort($_POST['getp']);
			admin_project_update($thissort);
		}
	}
	else if(isset($_POST['addp'])){
		if($_POST['addp'])
		{
			include('../views/admin.project.update.php');
			$thissortup['sortupid']=$_POST['addp'];
			$thissortup['sortupname']=getdataf('sortname',"app_sort","sortid",$_POST['addp']);
			admin_project_update($thissortup);
		}
	}
	else if(isset($_POST['delp'])){
		$d=0;
		$d=deletef("app_sort",'sortid',$_POST['delp']);
		if($d==1){
			echo "OK";
		}
		else
		{
			echo 'NOT';
		}
	}
	else if(isset($_POST['getg'])){
		if($_POST['getg'])
		{
			include('../views/admin.group.update.php');
			$thisgroup=get_group_xx($_POST['getg']);
			$thisgroup['groupid']=$_POST['getg'];
			admin_group_update($thisgroup);
		}
	}
	else{
		
		include('../views/admin.index.head.php');
		include('../views/admin.index.php');
		admin_index();
		include('../views/admin.index.bottom.php');
	}	
	}
	
}
else
{
	echo "请登陆！";
}
	


?>